﻿using UnityEngine;
using System.Collections;

public class ContactDestroy : MonoBehaviour {

	// Updated April 25th - Chris Rabideau
	// Modified May 25th - Will Whittaker

	public int bulletDamage;

	// When this object collides with another one, do whatever we want to the objects.
	void OnTriggerEnter(Collider other)
	{
		// First Check: Don't destroy the player with their own bullets.
		// This should be updated to check if these are the player's bullets later on.
		//
		// Second Check: Don't destroy other bullets.
		// This should be updated if it's decided player bullets should destroy enemy bullets and vice verse.
		if (other.tag != "Player")
		{
			return;
		}

		GameManager.playerHealth -= bulletDamage; // Deal damage to the player
		Destroy (gameObject); // Destroy this object.
	}

}
